OVPN vs IPSec performance as a transport
Hi,
I have been testing OVPN 2.4.4 vs StrongSwan IPSec, to be used as transport, and I have found something that I think might be a performance issue. I have 3 linux boxes, A, B, and C. All interfaces are 1Gbps. Each has an interface to the next one downstream:
A - eth0=10.10.10.10/24 and eth1=172.16.0.10/24
B - eth0=172.16.0.11/24 and eth1=172.30.0.11/24
C - eth0=172.30.0.10/24 and eth1=192.168.168.10/24
Packets route as usual through this with no encryption, and throughput from A to C is at wire speed. With IPSec between A&B, from 172.16.0.10-172.16.0.11, I can still get wire speed from A to C. Then I turn off IPSec, and I setup A as the server and B as the client, with A's config being:
=====
dev tun
topology subnet
server 172.17.0.0 255.255.255.0
port 1194
proto udp
dh /etc/openvpn/keys/dh2048.pem
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
key /etc/openvpn/keys/server.key
verb 3
keepalive 10 45
cipher aes-256-cbc
comp-lzo
tun-mtu 50000
mssfix 0
fragment 0
client-config-dir ccd
push "route 10.10.10.0 255.255.255.0"
=====
and the client B config file is
=====
verb 3
client
cipher AES-256-CBC
comp-lzo
tun-mtu 50000
mssfix 0
fragment 0
remote 172.16.0.10 1194
dev tun
redirect-private local
tls-client
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/client1.crt
key /etc/openvpn/keys/client1.key
=====
and I setup static routes on each side so that traffic is going through the tunnel from A to C and vice versa.
I can pass traffic over this link, however when I do tests for speed, I am only getting about 200Mbps instead of 1Gbps.
The funny thing is, I know that each of these machines can easily do 1Gbps. If I do my performance test from A to B, over the above ovpn configs, I can get just over 1Gbps because of the MTU overhead being removed. But as soon as I have it make the leap downstream once more, I lose 80+% of the speed. And again, both non-encrypted traffic and IPSec do the exact same test at wire speed or just slightly under wire speed.
The way I do a speed test is on A:
# nc -l -p 5555 > /dev/null
and over on C:
# dd if=/dev/urandom of=blob.random.1G bs=10M count=100
# time cat blob.random.1G | nc 10.10.10.10 5555
tcpdumps over each interface confirm traffic is flowing in the expected fashion.
Over unencrypted or IPSec, I am looking at about 4s to move 1G of data from one end to the other, and with ovpn, 15-22s. The machines involved are 2 Dell R720's with 8+G ram and a homebrew machine with several Xeons and 32G RAM. Network cards involved are a mix of BCM Tigon3 "tg3" driver and IGB driver gigabit NICs.
Anyone have any suggestions or thoughts as to why the big perf decrease and what might be done to improve it?
Thanks,
Tom
I'm sure someone else, or a Google search will get you a more detailed run-down - but the gist of the "problem" is this;
OpenVPN is run in user-space, not kernel space. IPSec runs in kernel space, and the difference is vastly diminished throughput.
HTH
-Greg
Quoted 122 lines · Tom Kunz
Hi,
I have been testing OVPN 2.4.4 vs StrongSwan IPSec, to be used as transport, and I have found something that I think might be a performance issue. I have 3 linux boxes, A, B, and C. All interfaces are 1Gbps. Each has an interface to the next one downstream:
A - eth0=10.10.10.10/24 and eth1=172.16.0.10/24
B - eth0=172.16.0.11/24 and eth1=172.30.0.11/24
C - eth0=172.30.0.10/24 and eth1=192.168.168.10/24
Packets route as usual through this with no encryption, and throughput from A to C is at wire speed. With IPSec between A&B, from 172.16.0.10-172.16.0.11, I can still get wire speed from A to C. Then I turn off IPSec, and I setup A as the server and B as the client, with A's config being:
=====
dev tun
topology subnet
server 172.17.0.0 255.255.255.0
port 1194
proto udp
dh/etc/openvpn/keys/dh2048.pem
ca/etc/openvpn/keys/ca.crt
cert/etc/openvpn/keys/server.crt
key/etc/openvpn/keys/server.key
verb 3
keepalive 10 45
cipher aes-256-cbc
comp-lzotun-mtu 50000
mssfix 0
fragment 0
client-config-dir ccd
push "route 10.10.10.0 255.255.255.0"
=====
and the client B config file is
=====
verb 3
client
cipher AES-256-CBC
comp-lzo
tun-mtu 50000
mssfix 0
fragment 0
remote 172.16.0.10 1194dev tun
redirect-private local
tls-clientca
/etc/openvpn/keys/ca.crt
cert/etc/openvpn/keys/client1.crt
key/etc/openvpn/keys/client1.key=====
and I setup static routes on each side so that traffic is going through the tunnel from A to C and vice versa.
I can pass traffic over this link, however when I do tests for speed, I am only getting about 200Mbps instead of 1Gbps.
The funny thing is, I know that each of these machines can easily do 1Gbps. If I do my performance test from A to B, over the above ovpn configs, I can get just over 1Gbps because of the MTU overhead being removed. But as soon as I have it make the leap downstream once more, I lose 80+% of the speed. And again, both non-encrypted traffic and IPSec do the exact same test at wire speed or just slightly under wire speed.
The way I do a speed test is on A:
# nc -l -p 5555 > /dev/nulland over on C:
# dd if=/dev/urandom of=blob.random.1G bs=10M count=100# time cat blob.random.1G | nc 10.10.10.10 5555tcpdumps over each interface confirm traffic is flowing in the expected fashion.
Over unencrypted or IPSec, I am looking at about 4s to move 1G of data from one end to the other, and with ovpn, 15-22s. The machines involved are 2 Dell R720's with 8+G ram and a homebrew machine with several Xeons and 32G RAM. Network cards involved are a mix of BCM Tigon3 "tg3" driver and IGB driver gigabit NICs.
Anyone have any suggestions or thoughts as to why the big perf decrease and what might be done to improve it?
Thanks,
Tom
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
That would explain it if it always worked that way.
But I can get 400%+ wire speed from A to B with compressible data, and 102% with incompressible data. If I do the same test from B to A or A to B, I get those results. If I hop off of that to C, speed goes from
Quoted 1 line
1Gbps to sub-200Mbps. In either case, the data has left the kernel
space to arrive at "nc", so just simply saying "it's kernel vs user" doesn't answer it.
Quoted 149 lines · Greg Sloop
I'm sure someone else, or a Google search will get you a more detailed run-down - but the gist of the "problem" is this;
OpenVPN is run in user-space, not kernel space. IPSec runs in kernel space, and the difference is vastly diminished throughput.
HTH
-Greg
On Jan 4, 2018 3:23 PM, "Tom Kunz" <[email protected]... <mailto:[email protected]...>> wrote:
Hi,
I have been testing OVPN 2.4.4 vs StrongSwan IPSec, to be used as transport, and I have found something that I think might be a performance issue. I have 3 linux boxes, A, B, and C. All interfaces are 1Gbps. Each has an interface to the next one downstream:
A - eth0=10.10.10.10/24 <http://10.10.10.10/24> and eth1=172.16.0.10/24 <http://172.16.0.10/24>
B - eth0=172.16.0.11/24 <http://172.16.0.11/24> and eth1=172.30.0.11/24 <http://172.30.0.11/24>
C - eth0=172.30.0.10/24 <http://172.30.0.10/24> and eth1=192.168.168.10/24 <http://192.168.168.10/24>
Packets route as usual through this with no encryption, and throughput from A to C is at wire speed. With IPSec between A&B, from 172.16.0.10-172.16.0.11, I can still get wire speed from A to C. Then I
turn off IPSec, and I setup A as the server and B as the client, with A's config being:=====
dev tun
topology subnet
server 172.17.0.0 255.255.255.0
port 1194
proto udp
dh/etc/openvpn/keys/dh2048.pem
ca/etc/openvpn/keys/ca.crt
cert/etc/openvpn/keys/server.crt
key/etc/openvpn/keys/server.key
verb 3
keepalive 10 45
cipher aes-256-cbc
comp-lzotun-mtu 50000
mssfix 0
fragment 0
client-config-dir ccd
push "route 10.10.10.0 255.255.255.0"
=====
and the client B config file is
=====
verb 3
client
cipher AES-256-CBC
comp-lzo
tun-mtu 50000
mssfix 0
fragment 0
remote 172.16.0.10 1194dev tun
redirect-private local
tls-clientca
/etc/openvpn/keys/ca.crt
cert/etc/openvpn/keys/client1.crt
key/etc/openvpn/keys/client1.key=====
and I setup static routes on each side so that traffic is going through
the tunnel from A to C and vice versa.I can pass traffic over this link, however when I do tests for speed, I
am only getting about 200Mbps instead of 1Gbps.The funny thing is, I know that each of these machines can easily do 1Gbps. If I do my performance test from A to B, over the above ovpn configs, I can get just over 1Gbps because of the MTU overhead being removed. But as soon as I have it make the leap downstream once more, I
lose 80+% of the speed. And again, both non-encrypted traffic and IPSec
do the exact same test at wire speed or just slightly under wire speed.The way I do a speed test is on A:
# nc -l -p 5555 >
/dev/nulland over on C:
# dd if=/dev/urandom of=blob.random.1G bs=10M count=100
# time cat blob.random.1G | nc 10.10.10.10 5555
tcpdumps over each interface confirm traffic is flowing in the expected
fashion.Over unencrypted or IPSec, I am looking at about 4s to move 1G of data from one end to the other, and with ovpn, 15-22s. The machines involved
are 2 Dell R720's with 8+G ram and a homebrew machine with several Xeons
and 32G RAM. Network cards involved are a mix of BCM Tigon3 "tg3" driver and IGB driver gigabit NICs.Anyone have any suggestions or thoughts as to why the big perf decrease
and what might be done to improve it?Thanks,
Tom
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list [email protected] <mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
<https://lists.sourceforge.net/lists/listinfo/openvpn-devel>
This does not answer your question, either, but there are more details on OpenVPN performance optimization here:
<https://community.openvpn.net/openvpn/wiki/Gigabit_Networks_Linux>
Increasing the MTU helps as it reduces the number of user<->kernel-space switches.
Signature · 7 lines
Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock Il 05/01/2018 01:52, Tom Kunz ha scritto:
Quoted 173 lines
That would explain it if it always worked that way.
But I can get 400%+ wire speed from A to B with compressible data, and 102% with incompressible data. If I do the same test from B to A or A to B, I get those results. If I hop off of that to C, speed goes fromQuoted 1 line
1Gbps to sub-200Mbps. In either case, the data has left the kernel
space to arrive at "nc", so just simply saying "it's kernel vs user" doesn't answer it.
Quoted 139 lines · Greg Sloop
I'm sure someone else, or a Google search will get you a more detailed run-down - but the gist of the "problem" is this;
OpenVPN is run in user-space, not kernel space. IPSec runs in kernel space, and the difference is vastly diminished throughput.
HTH
-Greg
On Jan 4, 2018 3:23 PM, "Tom Kunz" <[email protected]... <mailto:[email protected]...>> wrote:
Hi,
I have been testing OVPN 2.4.4 vs StrongSwan IPSec, to be used as transport, and I have found something that I think might be a performance issue. I have 3 linux boxes, A, B, and C. All interfaces are 1Gbps. Each has an interface to the next one downstream:
A - eth0=10.10.10.10/24 <http://10.10.10.10/24> and eth1=172.16.0.10/24 <http://172.16.0.10/24>
B - eth0=172.16.0.11/24 <http://172.16.0.11/24> and eth1=172.30.0.11/24 <http://172.30.0.11/24>
C - eth0=172.30.0.10/24 <http://172.30.0.10/24> and eth1=192.168.168.10/24 <http://192.168.168.10/24>
Packets route as usual through this with no encryption, and throughput from A to C is at wire speed. With IPSec between A&B, from 172.16.0.10-172.16.0.11, I can still get wire speed from A to C. Then I
turn off IPSec, and I setup A as the server and B as the client, with A's config being:=====
dev tun
topology subnet
server 172.17.0.0 255.255.255.0
port 1194
proto udp
dh/etc/openvpn/keys/dh2048.pem
ca/etc/openvpn/keys/ca.crt
cert/etc/openvpn/keys/server.crt
key/etc/openvpn/keys/server.key
verb 3
keepalive 10 45
cipher aes-256-cbc
comp-lzotun-mtu 50000
mssfix 0
fragment 0
client-config-dir ccd
push "route 10.10.10.0 255.255.255.0"
=====
and the client B config file is
=====
verb 3
client
cipher AES-256-CBC
comp-lzo
tun-mtu 50000
mssfix 0
fragment 0
remote 172.16.0.10 1194dev tun
redirect-private local
tls-clientca
/etc/openvpn/keys/ca.crt
cert/etc/openvpn/keys/client1.crt
key/etc/openvpn/keys/client1.key=====
and I setup static routes on each side so that traffic is going through
the tunnel from A to C and vice versa.I can pass traffic over this link, however when I do tests for speed, I
am only getting about 200Mbps instead of 1Gbps.The funny thing is, I know that each of these machines can easily do 1Gbps. If I do my performance test from A to B, over the above ovpn configs, I can get just over 1Gbps because of the MTU overhead being removed. But as soon as I have it make the leap downstream once more, I
lose 80+% of the speed. And again, both non-encrypted traffic and IPSec
do the exact same test at wire speed or just slightly under wire speed.The way I do a speed test is on A:
# nc -l -p 5555 >
/dev/nulland over on C:
# dd if=/dev/urandom of=blob.random.1G bs=10M count=100
# time cat blob.random.1G | nc 10.10.10.10 5555
tcpdumps over each interface confirm traffic is flowing in the expected
fashion.Over unencrypted or IPSec, I am looking at about 4s to move 1G of data from one end to the other, and with ovpn, 15-22s. The machines involved
are 2 Dell R720's with 8+G ram and a homebrew machine with several Xeons
and 32G RAM. Network cards involved are a mix of BCM Tigon3 "tg3" driver and IGB driver gigabit NICs.Anyone have any suggestions or thoughts as to why the big perf decrease
and what might be done to improve it?Thanks,
Tom
Quoted 10 lines
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list [email protected] <mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
<https://lists.sourceforge.net/lists/listinfo/openvpn-devel>------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Hi Samuli,
Yes, that was the document that I read before going down this path. I did a bunch of testing and found the optimum MTU range in my setup is 47500 to 52500, and 50000 is probably as close to the peak as necessary.
When I have 2 nodes, nothing between them and not routing to elsewhere, the extra bandwidth from the large MTU gives me 102% or so of wire speed throughput when I transfer incompressible data (derived from /dev/urandom). I can do this very reproducibly and predictably. For data-compressibility tests, I used two different forms, one was highly compressible data (derived from /dev/zero) and the other was the tarball (not gzipped, just tar) of linux kernel source code. With the file created from uncompressed linux kernel source, where lzo can do some work, I can regularly get 140-150% wire speed, and with highly-compressible data I get just over 400%. Meaning, I can transfer all-nulls over a 1Gbps link as if it was a 4Gbps link, and text as if it was a 1.5Gbps link. This is good stuff for the bandwidth-constrained!
So really the only problem is getting that data back out of ovpn and onto a physical hardware interface to another place. OVPN is absolutely awesome, otherwise.
The things I have already tried to mess around with to affect performance:
- Toggle comp-lzo on/off. No effect.
- Change encryption algorithm, including change to "none". No effect.
- Change sndbuf/rcvbuf socket buffers to 425984(basically doubling defaults). No effect.
- Change tun-mtu. Any changes too far off of my existing 50000 cause perf degradation.
- Change txqueuelen on all interfaces to 1000000. Slight effect, maybe 5-10% gains or so. (Possibly trimmed 1-2s off a ~20s transfer)
- Turning off checksumming on all interfaces: ethtool -K {dev} rx off tx off No effect.
- No iptables running at all on anything.
Again, keep in mind that full wire speed is realized with no vpn, and with IPSec.
So, to reason this through a little:
- No vpn = fast.
- IPSec = fast.
- OVPN->OVPN = even faster
- OVPN->OVPN->routing/hardware = slow, down to about 200Mbps from 1+Gbps.
I'm wondering if the bottleneck is in the tun/tap driver's ability to copy data out to the hardware device or to the buffers to be processed for routing?
BTW, the host OS is Ubuntu server 16.04.3 on all of these, kernel 4.4.0-104-generic and the TUN is built-in to the kernel, not a module. I have not experimented with other kernel versions.
Thanks for any thoughts,
Tom
Quoted 8 lines · Samuli Seppänen
This does not answer your question, either, but there are more details on OpenVPN performance optimization here:
<https://community.openvpn.net/openvpn/wiki/Gigabit_Networks_Linux>
Increasing the MTU helps as it reduces the number of user<->kernel-space switches.
-SNIP-
I haven't taken the time to fully understand the tests you've done etc. [And it does seem you are not some neophyte blindly hacking your way through this...]
However, I will tell you that it's *very* common for people to do things that appear very similarly as you describe, and find the IPSec throughput is vastly better then OpenVPN. [That's always been my experience in any benchmarking I've done - and I've done some.] Each time I've seen it discussed - I've seen repeated threads all pointing to the kernel vs user space arguments.
And all my own testing also shows that to be the case.
IIRC, in the platforms I've tested, OVPN isn't CPU constrained - the connection will max out throughput far earlier than CPU exhaustion. IPSec will scale more or less directly with CPU performance - and at max throughput the CPU handling encryption will max out. (I suppose this might not be true in a system with in-hardware AES or other encryption off-loading - and the ethernet interface will become the bottleneck, not the CPU - but where I've run tests, that was never the case. It's, admittedly, been a while since I've done any real throughput tests on a test-bed setup.)
TK> Again, keep in mind that full wire speed is realized with no vpn, and TK> with IPSec.
TK> So, to reason this through a little:
1) TK> - No vpn = fast.
2) TK> - IPSec = fast.
3) - OVPN->>OVPN = even faster
4) - OVPN->>OVPN->routing/hardware = slow, down to about 200Mbps from 1+Gbps.
I may certainly be wrong, but I'd be *really* skeptical about #3. I've *never* seen a case where the performance of OpenVPN is better than IPSec on the same platform.
And if #3 is wrong, your "tinkering" with #4 will never yield something useful.
Obviously, I'd want to be pretty sure the straight OVPN <-> OVPN tests are accurate before trying to solve #4.
-Greg
Quoted 28 lines
-SNIP-
I haven't taken the time to fully understand the tests you've done etc. [And it does seem you are not some neophyte blindly hacking your way through this...]However, I will tell you that it's *very* common for people to do things that appear very similarly as you describe, and find the IPSec throughput is vastly better then OpenVPN. [That's always been my experience in any benchmarking I've done - and I've done some.] Each time I've seen it discussed - I've seen repeated threads all pointing to the kernel vs user space arguments.
And all my own testing also shows that to be the case.
IIRC, in the platforms I've tested, OVPN isn't CPU constrained - the connection will max out throughput far earlier than CPU exhaustion. IPSec will scale more or less directly with CPU performance - and at max throughput the CPU handling encryption will max out. (I suppose this might not be true in a system with in-hardware AES or other encryption off-loading - and the ethernet interface will become the bottleneck, not the CPU - but where I've run tests, that was never the case. It's, admittedly, been a while since I've done any real throughput tests on a test-bed setup.)
TK> Again, keep in mind that full wire speed is realized with no vpn, and TK> with IPSec.
TK> So, to reason this through a little:
Quoted 8 lines
1) TK> - No vpn = fast.
2) TK> - IPSec = fast.
3) - OVPN->>OVPN = even faster
4) - OVPN->>OVPN->routing/hardware = slow, down to about 200Mbps from 1+Gbps.I may certainly be wrong, but I'd be *really* skeptical about #3. I've
I may be wrong but I think it's simply the effect of LZO compression and the nature of transferred data. Without LZO (or any other compression like LZ4) I'm quite sure the speed is almost identical to #2 with IPSec.
Quoted 7 lines
*never* seen a case where the performance of OpenVPN is better than IPSec on the same platform.
And if #3 is wrong, your "tinkering" with #4 will never yield something useful.
Obviously, I'd want to be pretty sure the straight OVPN <-> OVPN tests are accurate before trying to solve #4.
Still, I believe a dump on host B should reveal where the bottleneck is. I'm also not sure the simple 'ethtool -K {dev} rx off tx off' is enough here. Did you also look at ethernet features
- scatter-gather
- TCP segmentation offload
- UDP fragmentation offload
- generic segmentation offload
- generic receive offload
I know that the default settings can slow down data transfers horribly with some traffic shaping configurations. I expect they can also have an effect here.
Regards,
Simon
- large receive offload
Hi,
Quoted 7 lines
That would explain it if it always worked that way.
But I can get 400%+ wire speed from A to B with compressible data, and 102% with incompressible data. If I do the same test from B to A or A to B, I get those results. If I hop off of that to C, speed goes fromQuoted 1 line
1Gbps to sub-200Mbps. In either case, the data has left the kernel
space to arrive at "nc", so just simply saying "it's kernel vs user" doesn't answer it.
So if I understand correctly you are able to get wire speed over the OpenVPN link as long as you don't route traffic further via an other simple router?
Maybe you could try those two things:
1) Disable all LZO compression just to make sure it has nothing to do with it.
2) Run tcpdump/wireshark on B and look in detail how data is moved over the different tun and ethernet devices. I'm sure you should see something there at least if you compare it with a run made without OpenVPN.
BTW, you don't have any iptables rules on any of the boxes, do you?
And, you could check all the kinds of checksumming and offloading on your ethernet interfaces. Those settings can have a huge impact if they do things wrong.
Regards,
Simon
Hi,
Quoted 14 lines · Simon Matter
Hi,
Quoted 7 lines
That would explain it if it always worked that way.
But I can get 400%+ wire speed from A to B with compressible data, and 102% with incompressible data. If I do the same test from B to A or A to B, I get those results. If I hop off of that to C, speed goes fromQuoted 1 line
1Gbps to sub-200Mbps. In either case, the data has left the kernel
space to arrive at "nc", so just simply saying "it's kernel vs user" doesn't answer it.
So if I understand correctly you are able to get wire speed over the OpenVPN link as long as you don't route traffic further via an other simple router?
Quoted 7 lines
Maybe you could try those two things:
1) Disable all LZO compression just to make sure it has nothing to do with it.2) Run tcpdump/wireshark on B and look in detail how data is moved over the different tun and ethernet devices. I'm sure you should see something there at least if you compare it with a run made without OpenVPN.
I agree on this point. If the slowdown comes from here, you should definitely see something.
Quoted 3 lines
BTW, you don't have any iptables rules on any of the boxes, do you?
Good point: iptables/ebtables can kill performances quite fast. Are doing pure routing between the VPN tunnel and the Ethernet interface? Or there is some NAT involved?
Cheers,
Signature · 1 line
Antonio Quartulli
Quoted 6 lines · Tom Kunz
That would explain it if it always worked that way.
But I can get 400%+ wire speed from A to B with compressible data, and 102% with incompressible data. If I do the same test from B to A or A to B, I get those results. If I hop off of that to C, speed goes fromQuoted 1 line
1Gbps to sub-200Mbps. In either case, the data has left the kernel
space to arrive at "nc", so just simply saying "it's kernel vs user" doesn't answer it.
actually, it does answer it: I've ran similar tests a few years back and got similar results. See
https://homepages.staff.os3.nl/~delaat/rp/2010-2011/p09/report.pdf
for the report.
Here's what happens:
if you run nc on the VPN endpoints themselves, then the OS can make use of the fact that the tun MTU is set to a very high value - thus you can easily achieve line speeds. However, as soon as you try to reach a machine beyond either VPN endpoint, then all traffic is fragmented to the MTU of the LAN , so normally that's 1500, possibly 6000. On your host C, all packets are chopped into 1500 bytes fragments (payload = 1472 bytes) and *THESE* packets are received by the OpenVPN endpoint, then compressed, encrypted, possibly fragmented and sent to the remove end. The tun MTU is never reached in this case, as each packet is handled separately. So yes, OpenVPN *IS* capped by the number of kernel-to-userspace transitions. On a high clockspeed CPU (e.g. i5-6000 series or higher with high turbo speed) you can achieve close to line speed, although I have yet to find out what MELTDOWN and the fix for it will to do the maximum speeds.
As IPsec runs in kernel space, it does not suffer from the large number of transitions and it can thus achieve higher speeds going from A-B->C
Hope this clarifies things,
JJK
Quoted 161 lines · Greg Sloop
Quoted 138 lines
I'm sure someone else, or a Google search will get you a more detailed run-down - but the gist of the "problem" is this;
OpenVPN is run in user-space, not kernel space. IPSec runs in kernel space, and the difference is vastly diminished throughput.
HTH
-Greg
On Jan 4, 2018 3:23 PM, "Tom Kunz" <[email protected]... <mailto:[email protected]...>> wrote:
Hi,
I have been testing OVPN 2.4.4 vs StrongSwan IPSec, to be used as transport, and I have found something that I think might be a performance issue. I have 3 linux boxes, A, B, and C. All interfaces are 1Gbps. Each has an interface to the next one downstream:
A - eth0=10.10.10.10/24 <http://10.10.10.10/24> and eth1=172.16.0.10/24 <http://172.16.0.10/24>
B - eth0=172.16.0.11/24 <http://172.16.0.11/24> and eth1=172.30.0.11/24 <http://172.30.0.11/24>
C - eth0=172.30.0.10/24 <http://172.30.0.10/24> and eth1=192.168.168.10/24 <http://192.168.168.10/24>
Packets route as usual through this with no encryption, and throughput
from A to C is at wire speed. With IPSec between A&B, from 172.16.0.10-172.16.0.11, I can still get wire speed from A to C. Then I
turn off IPSec, and I setup A as the server and B as the client, with A's config being:=====
dev tun
topology subnet
server 172.17.0.0 255.255.255.0
port 1194
proto udp
dh/etc/openvpn/keys/dh2048.pem
ca/etc/openvpn/keys/ca.crt
cert/etc/openvpn/keys/server.crt
key/etc/openvpn/keys/server.key
verb 3
keepalive 10 45
cipher aes-256-cbc
comp-lzotun-mtu 50000
mssfix 0
fragment 0
client-config-dir ccd
push "route 10.10.10.0 255.255.255.0"
=====
and the client B config file is
=====
verb 3
client
cipher AES-256-CBC
comp-lzo
tun-mtu 50000
mssfix 0
fragment 0
remote 172.16.0.10 1194dev tun
redirect-private local
tls-clientca
/etc/openvpn/keys/ca.crt
cert/etc/openvpn/keys/client1.crt
key/etc/openvpn/keys/client1.key=====
and I setup static routes on each side so that traffic is going through
the tunnel from A to C and vice versa.I can pass traffic over this link, however when I do tests for speed, I
am only getting about 200Mbps instead of 1Gbps.The funny thing is, I know that each of these machines can easily do 1Gbps. If I do my performance test from A to B, over the above ovpn configs, I can get just over 1Gbps because of the MTU overhead being removed. But as soon as I have it make the leap downstream once more, I
lose 80+% of the speed. And again, both non-encrypted traffic and IPSec
do the exact same test at wire speed or just slightly under wire speed.The way I do a speed test is on A:
# nc -l -p 5555 >
/dev/nulland over on C:
# dd if=/dev/urandom of=blob.random.1G bs=10M count=100
# time cat blob.random.1G | nc 10.10.10.10 5555
tcpdumps over each interface confirm traffic is flowing in the expected
fashion.Over unencrypted or IPSec, I am looking at about 4s to move 1G of data
from one end to the other, and with ovpn, 15-22s. The machines involved
are 2 Dell R720's with 8+G ram and a homebrew machine with several Xeons
and 32G RAM. Network cards involved are a mix of BCM Tigon3 "tg3" driver and IGB driver gigabit NICs.Anyone have any suggestions or thoughts as to why the big perf decrease
and what might be done to improve it?Thanks,
Tom
Quoted 10 lines
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list [email protected] <mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
<https://lists.sourceforge.net/lists/listinfo/openvpn-devel>------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel